<h2>DESCRIPTION</h2>

The <em>g.copy</em> module creates a copy of existing raster maps,
vector maps, or other elements. The copy is always created in
the current mapset. The source data can be in the current mapset,
in an explicitly specified mapset, or in a mapset which is in the
current mapset search path (typically the PERMANENT mapset).

<p>
The maps and other elements to copy are specified in pairs
<b>from</b>,<b>to</b> according to their types.
Although typically only one map is copied in one module call,
multiple pairs can be provided for each type and multiple types
can be provided at the same time.

<h3>Relation to mapsets</h3>

A user may access data stored under the other mapsets listed in their
mapset search path. However, the user may only modify data stored
under their own current mapset. <em>g.copy</em> allows the user to copy
existing data files <b>from</b> other mapsets <b>to</b> the user's
current mapset (<code>g.mapset -p</code>). The files to be copied must exist in the
user's current mapset search path (<code>g.mapsets -p</code>) and location;
output is sent to the
relevant data element directory(ies) under the user's current mapset.

<h3>Behavior on error</h3>

Errors typically occur when a map or other element does not exist,
<b>from</b> and <b>to</b> are the same, <b>to</b> element
already exists and overwriting (e.g., by <b>--overwrite</b>) is not
enabled, or the <b>to</b> element has an illegal name.
 
When only one map or other element is requested to be copied and the copying
is not possible or fails, an error is reported.

<p>
If multiple maps or other elements are copied in one command,
<em>g.copy</em> attempts to copy as much as possible
even when problems occur with one of the elements.
In that case, copying of the element causing problems is skipped, and
<em>g.copy</em> proceeds with copying the remaining elements.

If nothing can be copied or an error occurred during one of the copy
operations, an error message is reported after other possible copy
operations were performed.

<h2>EXAMPLES</h2>

If the user wished to copy the existing raster
file <em>soils</em> to a file called <em>soils.ph</em> and
to copy an existing vector map <em>roads</em> to a file
called <em>rds.old</em>, the user could type:

<div class="code"><pre>
g.copy raster=soils,soils.ph
g.copy vector=roads,rds.old

# or even combined:
g.copy raster=soils,soils.ph vector=roads,rds.old
</pre></div>

<p>
Data files can also be specified by their mapsets.  For
example, the below command copies the raster map named
<em>soils</em> from the mapset <em>wilson</em> to a new
file called <em>soils</em> to be placed under the user's
current mapset:

<div class="code"><pre>
g.copy raster=soils@wilson,soils
</pre></div>

If no mapset name is specified, <em>g.copy</em> searches for the
named <b>from</b> map in each of the mapset directories listed in the
user's current mapset search path in the order in which mapsets are
listed there (see <em><a href="g.mapsets.html">g.mapsets</a></em>).

<h2>SEE ALSO</h2>

<em>
<a href="g.access.html">g.access</a>,
<a href="g.list.html">g.list</a>,
<a href="g.mapsets.html">g.mapsets</a>,
<a href="g.remove.html">g.remove</a>,
<a href="g.rename.html">g.rename</a>
</em>

<h2>AUTHOR</h2>

Michael Shapiro,
U.S. Army Construction Engineering 
Research Laboratory

<!--
<p>
<i>Last changed: $Date$</i>
-->
